package com.xd.pre.modules.tpshop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xd.pre.modules.tpshop.domain.TpCoupon;
import com.xd.pre.modules.tpshop.domain.TpUserAddress;
import com.xd.pre.modules.tpshop.mapper.TpUserAddressMapper;
import com.xd.pre.modules.tpshop.service.ITpUserAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lx
 * @since 2020-06-03
 */
@Service
public class TpUserAddressServiceImpl extends ServiceImpl<TpUserAddressMapper, TpUserAddress> implements ITpUserAddressService {

    @Override
    public TpUserAddress findUserAddress_byKeyId(Integer addressId) {
        return getById(addressId);
    }

    @Override
    public List<TpUserAddress> findTheUserAddress_byUserId(Integer userId) {
        LambdaQueryWrapper<TpUserAddress> lambdaQuery = Wrappers.lambdaQuery();
        lambdaQuery.eq(TpUserAddress::getUserId, userId);
        return list(lambdaQuery);
    }
}
